package yja.gzw.app.adapter

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import yja.gzw.app.R
import yja.gzw.app.model.bean.NotificationDatazhsc
import yja.gzw.app.model.bean.OrderData

class ZanheshoucangAdapter (private val context: Context, private val list: List<NotificationDatazhsc>): RecyclerView.Adapter<RecyclerView.ViewHolder>(){

    private var view: View?=null
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        view= LayoutInflater.from(parent.context).inflate(R.layout.item_view_zanheshoucang,parent,false)
        Log.e("图片地址展示","走到了2")
        return ViewHodeView(view!!)
    }

    override fun getItemCount(): Int {
       return list.size
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
       if(holder is ViewHodeView){
           val requestOptions = RequestOptions.bitmapTransform(CircleCrop())
           Glide.with(context).load("http://117ai.32.hzgqapp.com/"+list[position].userinfo.avatar)
               .apply(requestOptions)
               .into(holder.touxiang)

           holder.yonghuaname.text=list[position].userinfo.nickname

       }


    }
    inner class ViewHodeView(itemView: View):RecyclerView.ViewHolder(itemView){
        val touxiang: ImageView =itemView.findViewById(R.id.touxiang)
        val yonghuaname: TextView =itemView.findViewById(R.id.yonghuaname)
        val dianzaideneirong: ImageView =itemView.findViewById(R.id.dianzaideneirong)


    }

}